/*DrillExamRecord  考试记录*/
import request from "/@/utils/request";
import download from "/@/utils/download.ts";

const DrillExamRecordApi = {

    getPageData(data: any) {
        return request({
            url: "/drillExamRecord/pageData",
            method: "post",
            data,
        });
    },
    getDetail(data: any) {
        return request({
            url: "/drillExamRecord/getDetail",
            method: "post",
            data,
        });
    },

    save: (data: any) => {
        return request({
            url: "/drillExamRecord/save",
            method: "post",
            data,
        });
    },

    del: (data: any) => {
        return request({
            url: "/drillExamRecord/del",
            method: "post",
            data,
        });
    },

    updateStatus: (data: any) => {
        return request({
            url: "/drillExamRecord/updateStatus",
            method: "post",
            data,
        });
    },
    generateExamFile: (data: any) => {
        return request({
            url: "/drillExamRecord/generateExamFile",
            method: "post",
            data,
        });
    },
    pageDataXls:(_searchParam: any,_xlsTitle: any) => {
             const param = new URLSearchParams();
        param.append("_searchParam",JSON.stringify(_searchParam))
        param.append("_xlsTitle",_xlsTitle)
        return request({
            url: "/drillExamRecord/pageDataXls",
            method: "post",
            responseType: 'blob',
            headersType: 'application/json;charset=UTF-8',
            params:param,
        }).then((res)=> {
            download(res)
        });
    },
    // 下载文件
    downloadAttachments(url: string, fileName: string) {
        axios({
            method: "get",
            url,
            responseType:"blob"
        }
        ).then(res=>{
            download(res,fileName)
        })
    },
};
export default DrillExamRecordApi;
